/*
 * @Author: frosty
 * @Date: 2019-11-27 19:58:49
 * @LastEditTime : 2020-02-18 11:20:49
 * @LastEditors  : Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \hello-vue\src\router\index.js
 */
import Vue from 'vue'
import Router from 'vue-router'
import Login from '../views/Login'
import Main from '../views/Main'
import UserInfo from '../views/user/UserInfo'
import UserList from '../views/user/UserList'
import  NotFund from  "../views/error/404"
import Exception from "../views/error/500"
import Register from "../views/user/Register"

Vue.use(Router);

export default new Router({
  mode:"history", /*去掉路径中的 # */
  routes: [
    {
      path:"*",
      component:NotFund
    },
 

    {
      path:"/500",
      component: Exception
    },

    {
      //登录 s页
      path: "/login",
      name: "Login",
      component: Login
    },

    {
      path:"/user/register",
      name:"Register",
      component:Register

 },
    {
      //首页
      path: "/main",
      props:true,
      name: "Main",
      component: Main,
      children: [  /*main 页面 配置子路由  有点像iframe*/
        {
          path: "/user/info",
          props:true,  //允许带属性
          name: "UserInfo",
          component: UserInfo
        },
        {
          path: "/user/list",
          name: "UserList",
          component: UserList
        },


      ]

    },
    {
      path:"/*",
      name: "Login",
      component: Login
    },
  ]

})
